#ifndef __NFCAPIBRIDGEPLUGIN_H__
#define __NFCAPIBRIDGEPLUGIN_H__

//  Include Files

#include <e32base.h>	// CBase
#include <e32std.h>	 // TBuf
#include <Servlet.h>

#include "NfcApiBridgeSession.h"

#include "Log.h"

// Forward declarations

class RQueryParser;

//  Class Definitions

class CNfcApiBridgePlugin : public CServlet
{
public:
    static CNfcApiBridgePlugin* NewL();
    static CNfcApiBridgePlugin* NewLC();
    virtual ~CNfcApiBridgePlugin();

private: //from MServlet
    /**
     * Receives the request from widget and calls DoServiceL()
     */
    void ServiceL(MHttpRequest* aReq);
    
    class TSecurityDescriptor : public MSecurityDescriptor
        {
        TSecurityType GetSecurityType() { return ENone; }
        TBool IsClientValid( const TDesC8& /*hash*/ ) { return ETrue; }
        };
    
    TSecurityDescriptor iSecurityDescriptor;
    MSecurityDescriptor* GetSecurityDescriptorL() {return &iSecurityDescriptor; }
    
private:
    CNfcApiBridgePlugin();
    void ConstructL();
    void DoServiceL(MHttpRequest* aReq);

private:
    void ReadTagL(MHttpServletResponse & aResponse, RQueryParser & aParser, TDesC8 const & aWidgetId);
    void SetForegroundL(MHttpServletResponse & aResponse, RQueryParser & aParser, TDesC8 const & aWidgetId);
    
    void SendMessageL(MHttpServletResponse & aResponse, RQueryParser & aParser, TDesC8 const & aWidgetId);
    void SetResponseL(MHttpServletResponse & aResponse, RQueryParser & aParser, TDesC8 const & aWidgetId);
    void TransactionLogL(MHttpServletResponse & aResponse, RQueryParser & aParser, TDesC8 const & aWidgetId);
    
private:
    
    RNfcApiBridgeSession iSession;
    
#ifdef LOGGING
    RFs iFs;
#endif // LOGGING

};

#endif  // __NFCAPIBRIDGEPLUGIN_H__

